<?php
require_once ('dbconfig.php');

$dbh = mysql_connect ( DB_HOST, DB_USER, DB_PASS ) or die ( mysql_error () );
mysql_select_db ( DB_NAME );
?>

<head>
<title>Add a Taxable Moons</title>
</head>
<body>
<form action=newMoon.php " method="post">
<p>Corporation: <select name="corpId">
     
  <?php
		$corpSql = "select alCorpId, alCorpName from al_corps order by alCorpName";
		$result = mysql_query ( $corpSql, $dbh ) or die ( mysql_error () );
		$corpBox = "";
		while ( $newArray = mysql_fetch_array ( $result ) ) {
			$corpName = $newArray ['alCorpName'];
			$corpId = $newArray ['alCorpId'];
			$corpBox .= "<option value=\"$corpId\">$corpName</option>";
		} //end of while loop
		echo $corpBox;
		?>
	
</select> <br>
<br>
System: <select name="systemName">
 <?php
		$sysSql = "select sys_name from al_systems  where sys_sec < 0.5 and sys_sec <> -0.99000 order by sys_name";
		$result = mysql_query ( $sysSql, $dbh ) or die ( mysql_error () );
		$sysBox = "";
		while ( $newArray = mysql_fetch_array ( $result ) ) {
			$sysName = $newArray ['sys_name'];
			$sysBox .= "<option value=\"$sysName\">$sysName</option>";
		} //end of while loop
		echo $sysBox;
		?>
</select>
<br><br>
Planet: <input type="text" name="planet" size="2" maxlength="2"><br>
<br>
Moon: <input type="text" name="moon" size="3" maxlength="3"><br>
<br>
Tax Rate:<select name="taxRate">
  <?php
		$corpSql = "select alTaxRateId, alTaxRate, alTaxDesc from al_taxRate order by alTaxRateId";
		$result = mysql_query ( $corpSql, $dbh ) or die ( mysql_error () );
		$taxBox = "";
		while ( $newArray = mysql_fetch_array ( $result ) ) {
			$taxDesc = $newArray ['alTaxDesc'];
			$taxRate = $newArray ['alTaxRate'];
			$taxId = $newArray ['alTaxRateId'];
			$taxBox .= "<option value=\"$taxId\">$taxDesc - ";
			$taxBox .= number_format ( $taxRate, 2 );
			$taxBox .= "</option>";
		} //end of while loop
		echo $taxBox;
		?>

</select>
<br><br>
<input type="submit" name="submit" value="Add Moon">
</form>

















</body>